<?php

/*------------------------------------------------
*
*   Explay Engine Content Management System.
*   Copyright © 2008 Golovdinov Alexander.
*
*-------------------------------------------------
*
*   Official site: wwww.alex-home.spb.ru/explay.html
*   Contact e-mail: golovdinov@gmail.com
*
*   GNU General Public License original source:
*   http://www.gnu.org/licenses/gpl-3.0.html
*
------------------------------------------------*/

if (!defined("DB_PEREFIX")) exit;


$get = $db->query ("SELECT art_id, art_category, art_header, art_author, art_rating, cat.cat_header, usr.user_name FROM ".DB_PEREFIX."_articles AS art
		LEFT JOIN (SELECT cat_name, cat_header FROM ".DB_PEREFIX."_art_category) AS cat ON art.art_category = cat.cat_name
		LEFT JOIN (SELECT user_id, user_name FROM ".DB_PEREFIX."_users) AS usr ON art.art_id = usr.user_id
		WHERE art_publik = 'yes' AND art_category != '' AND art_rating > -3 AND art_visible = 'on' ORDER BY art_id DESC LIMIT 0,10");

$list = '';
	
Templater::load ('articles/announce.tpl');

while ($article = $db->fetch_array ($get)) {
	Templater::set_var ('article', $article);
	$list .= Templater::display_part ('item');
}

Templater::set_var ('list', $list);
CORE::body_replace ($replace, Templater::display_part ('list'));
